/**
 * Copyright &copy; 2012-2016 <a href="https://github.com/thinkgem/jeesite">JeeSite</a> All rights reserved.
 */
package com.server.modules.sys.service.juhe.usedcar;

import com.server.common.persistence.Page;
import com.server.common.service.CrudService;
import com.server.common.utils.StringUtils;
import com.server.modules.sys.dao.juhe.usedcar.JuheUsedcarSeriesDao;
import com.server.modules.sys.entity.juhe.usedcar.JuheUsedcarSeries;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.CollectionUtils;

import java.util.List;

/**
 * 聚合二手车接口车辆系列数据Service
 * @author 丁光彪
 * @version 2017-01-06
 */
@Service
@Transactional(readOnly = true)
public class JuheUsedcarSeriesService extends CrudService<JuheUsedcarSeriesDao, JuheUsedcarSeries> {

	public JuheUsedcarSeries get(String id) {
		return super.get(id);
	}
	
	public List<JuheUsedcarSeries> findList(JuheUsedcarSeries juheUsedcarSeries) {
		return super.findList(juheUsedcarSeries);
	}
	
	public Page<JuheUsedcarSeries> findPage(Page<JuheUsedcarSeries> page, JuheUsedcarSeries juheUsedcarSeries) {
		return super.findPage(page, juheUsedcarSeries);
	}
	
	@Transactional(readOnly = false)
	public void save(JuheUsedcarSeries juheUsedcarSeries) {
		super.save(juheUsedcarSeries);
	}
	
	@Transactional(readOnly = false)
	public void delete(JuheUsedcarSeries juheUsedcarSeries) {
		super.delete(juheUsedcarSeries);
	}

	@Transactional(readOnly = false)
    public boolean saveSeriess(List<JuheUsedcarSeries> list) {
		if(!CollectionUtils.isEmpty(list)){
			for (JuheUsedcarSeries obj : list) {
                String id = obj.getId();
                if(StringUtils.isNotBlank(id)){
					obj.preInsert();
                    obj.setId(id);
					dao.insert(obj);
				}
			}
			return true;
		}
		return false;
    }
}